package com.fairytask.tools
{
	import com.fairytask.engine.components.text.Label;
	import com.fairytask.engine.define.GoodQualityColorDefine;
	import com.fairytask.resource.StaticIni;
	
	import flash.display.Shape;

	/**
	 * 物品设置(物品框、数量格式等) 
	 * @author zhuy
	 * 
	 */	
	public class GoodSet
	{
		public function GoodSet()
		{
			
		}
		
		/**
		 * 获得图片框、框颜色
		 * @return 
		 * 
		 */		
		public static function getFrameData(configID:int):Array
		{
			var data:Array = new Array();
			var goodFram:Shape = new Shape();
			
			//物品框颜色设置
			var goodFramColorType:int = int(StaticIni.getIniVar(configID,"Color"));
			var framColor:int;
			switch(goodFramColorType)
			{
				case GoodQualityColorDefine.QualityTypeOne:
					framColor = GoodQualityColorDefine.QualityTypeOneColor;
					break;
				case GoodQualityColorDefine.QualityTypeTwo:
					framColor = GoodQualityColorDefine.QualityTypeTwoColor;
					break;
				case GoodQualityColorDefine.QualityTypeThree:
					framColor = GoodQualityColorDefine.QualityTypeThreeColor;
					break;
				case GoodQualityColorDefine.QualityTypeFour:
					framColor = GoodQualityColorDefine.QualityTypeFourColor;
					break;	
				case GoodQualityColorDefine.QualityTypeFive:
					framColor = GoodQualityColorDefine.QualityTypeFiveColor;
					break;
				case GoodQualityColorDefine.QualityTypeSix:
					framColor = GoodQualityColorDefine.QualityTypeSixColor;
					break;
			}
			goodFram.graphics.lineStyle(1,framColor,1);
			goodFram.graphics.drawRoundRect(2.5,3.5,50,50,6);
			goodFram.graphics.endFill();
			data.push(goodFram);	//边框
			data.push(framColor);	//颜色
			return data;
		}
		
		/**
		 * 设置物品数量格式,按格式要求显示:如 _1、11 
		 * 
		 */		
		public static function setNumPos(lab:Label,num:int):void
		{
			if(num<=9)
			{
				lab.x = 35;
				lab.y = 30;
			}
			else
			{
				lab.x = 30;
				lab.y = 30;
			}
			lab.htmlStrByBorder = num.toString();
		}
		
		/**
		 * 设置技能数量格式,按格式要求显示:如 _1、11 
		 * @param lab
		 * @param num
		 * 
		 */		
 		public static function setSkillNumPos(lab:Label,num:int):void
		{
			if(num<=9)
			{
				lab.x = 33;
				lab.y = 27;
			}
			else
			{
				lab.x = 28;
				lab.y = 27;
			}
			lab.htmlStrByBorder = num.toString();
		}
	}
}